package netty.v3.serializer;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class JSONSerializer<T> implements Serializer {

    @Override
    public byte[] serializer(Object object) {
        return JSON.toJSONBytes(object);
    }

    @Override
    public T deserializer(Class clazz, byte[] bytes) {
        return JSONObject.parseObject(bytes, clazz);
    }
}
